package com.neu.mianxiangduixiang;

import java.util.Arrays;
import java.util.Random;

public class PaiXu2 {
    public static void main(String[] args) {
        System.out.println(Arrays.toString(shuZu(80)));
    }
    public static int[] shuZu(int len){
        int [] x = new int [len];

        for (int i = 0; i < len; i++) {
            int r = (int) (Math.random()*100+1);//生成随机数
            boolean f = quChong(x,r);//判断是否为真
            x[i] = r;
            if (f==true){
                i--;
                continue;
            }
            x[i]=r;
        }
        return x;
    }

    public  static boolean quChong (int[] num,int ii){
        boolean flag = false;
        for (int i = 0; i < num.length; i++) {
            if (num[i]==ii){
                flag = true;
                break;
            }
        }
        return flag;

    }
}
